package com.ujoku.controller.admin;

import com.labillusion.core.platform.web.rest.RESTController;
import com.ujoku.domain.admin.Task;
import com.ujoku.service.admin.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Greg.Chen on 2015/3/11.
 */
@RestController
public class TaskMngController extends RESTController {

    @Autowired
    private TaskService taskService;

    @RequestMapping(value="/uj-admin/task/list", method = RequestMethod.GET)
    public List<Task> getList(){

        Map<String,Object> query = new HashMap<>();
        query.put("status" ,1);

        return taskService.selectList(query);
    }

    @RequestMapping(value="/uj-admin/task/refresh", method = RequestMethod.POST)
    public List<Task> refresh(){

        taskService.refresh();

        Map<String,Object> query = new HashMap<>();
        query.put("status" ,1);

        return taskService.selectList(query);
    }
}
